import {Injectable} from '@angular/core';

@Injectable()
export class GnLoginUser {
  username: string;
  name: string;
  authorities: any[];
  isLogin: boolean;

  public save(): void {
    sessionStorage.setItem('LoginUser', JSON.stringify(this));
  }

  public load(): void {
    const session = sessionStorage.getItem('LoginUser');
    if (session) {
      Object.assign(this, JSON.parse(session));
    }
  }
}
